namespace OutlookContacts
{
    public class Name
    {
        public readonly string firstName;
        public readonly string middleInitial;
        public readonly string lastName;

        public Name(string firstName, string middleInitial, string lastName)
        {
            this.firstName = firstName;
            this.middleInitial = middleInitial;
            this.lastName = lastName;
        }

        public override bool Equals(object other)
        {
            if (other == null) return false;
            if (other == this) return true;
            if (other.GetType() != GetType()) return false;
            Name otherName = (Name) other;
            return
                (otherName.firstName == firstName) & (otherName.middleInitial == middleInitial) &
                (otherName.lastName == lastName);
        }

        public override int GetHashCode()
        {
            return firstName.GetHashCode() + middleInitial.GetHashCode() + lastName.GetHashCode();
        }
    }
}